home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
c
/
tcxl551.zip
/
TCXL_INC.EXE
/
lha
/
INC
/
TCXLKEY.H
< prev
next >
Wrap
Text File
|
1990-10-01
|
10KB
|
182 lines
/*=====[ The TesSeRact(TM) CXL User Interface Development System ]======*
| Copyright (c) 1987-1990, Innovative Data Concepts. All Rights Reserved
|
| This Library is part of IDC's TesSeRact Development Tools product
| line. For information about other IDC products, call 1-215-884-3373.
*----------------------------------------------------------------------*
| <TCXLkey.h> : Public definitions and prototypes for TCXL Input system.
| (Middle level).
*-------------------------------[ Notes ]------------------------------*
| 1) Almost all of the keyboard-access functions are MS-DOS dependent.
*----------------------------------------------------------------------*
| PGS : $Id: tcxlkey.h 5.51 90/10/01 00:00:00 MLM Release Locker: MLM $
| $Log: tcxlkey.h $
| Revision 5.51 90/10/01 00:00:00 MLM
| TCXL 5.51
|
*======================================================================*/
#ifndef _TCXLkey_
# define _TCXLkey_ 1
# ifndef _TCXLdef_
# include <TCXLdef.h> /* standard definitions */
# endif
/*- KeyStat() return bits (MS-DOS) -------*/
#define KEY_RSH 0x01 /* [right shift] pressed */
#define KEY_LSH 0x02 /* [left shift] pressed */
#define KEY_CTL 0x04 /* [Ctrl] pressed */
#define KEY_ALT 0x08 /* [Alt] pressed */
#define KEY_SCR 0x10 /* [Scroll Lock] toggled */
#define KEY_NUM 0x20 /* [Num Lock] toggled */
#define KEY_CAP 0x40 /* [Caps Lock] toggled */
#define KEY_INS 0x80 /* [Ins] toggled */
#define KEY_EXT 0x80 /* KctlFlg = extended functions */
#define KEY_MNU 0x01 /* KctlFlg = currently in menu */
#define KEY_KBD 0x00 /* KctlSrc = keyboard */
#define KEY_QUE 0x01 /* KctlSrc = key-queue */
#define KEY_MOU 0x02 /* KctlSrc = mouse */
#define KEY_MAX 128 /* size of key-queue */
#define KEY_BRK 0xFFFF /* ^Break return from _KeyHit()/_KeyGet() */
/*------------------[ Data objects and access macros ]------------------*/
TYP union Kcod KcodT, *KcodP;
TYP struct Kctl KctlT, *KctlP;
TYP struct Kbnd KbndT, *KbndP;
union Kcod /*-[ Complete keycode ]----------*/
{ KeyT ckey; /* 00|00 : word overlay */
struct /* */
{ BytT asc; /* 00|00 : ASCII char or 0=ext */
BytT scn; /* 01|01 : scancode */
} c; /* */
}; /* 02|02 ]-----------------------*/
#define KcodKey(x) ((x).ckey)
#define KcodAsc(x) ((x).c.asc)
#define KcodScn(x) ((x).c.scn)
struct Kbnd /*-[ Key-binding object ]--------*/
{ KbndP bptr; /* 00|00 : next binding */
VfvCP bfun; /* 02|04 : bound function */
KeyT bkey; /* 04|08 : bound keycode */
KeyT brtn; /* 06|0C : return keycode */
}; /* 08|0E ]-----------------------*/
#define KbndPtr(b) ((b)->bptr)
#define KbndFun(b) ((b)->bfun)
#define KbndKey(b) ((b)->bkey)
#define KbndRtn(b) ((b)->brtn)
struct Kctl /*-[ Key-control object ]--------*/
{ BytT kflg; /* 00|00 : control-flag */
BytT ksrc; /* 01|01 : keycode source */
IntT kbeg; /* 02|02 : key-queue head */
IntT kend; /* 04|04 : key-queue tail */
IntT kcnt; /* 06|06 : key-queue count */
IntT kmax; /* 08|08 : key-queue size */
KeyP kbas; /* 0A|0A : key-queue base */
KbndP kbnd; /* 0C|0E : key-binding list */
VfvCP kidl; /* 0E|12 : idle-loop function */
KeyT khlp; /* 10|16 : help keycode */
VfvCP kfun; /* 12|18 : help function */
}; /* 14|1C ]-----------------------*/
GBL KctlT CDC _KeyCtl; /*- global key-control object ------------*/
#define KctlFlg (_KeyCtl.kflg) /* control-flag */
#define KctlMnu (0 != (KctlFlg & KEY_MNU)) /* in-menu */
#define KctlExt (0 != (KctlFlg & KEY_EXT)) /* extended */
#define KctlSrc (_KeyCtl.ksrc) /* keycode-source */
#define KctlKbd (KctlSrc == KEY_KBD) /* keyboard */
#define KctlQue (KctlSrc == KEY_QUE) /* key-queue */
#define KctlMou (KctlSrc == KEY_MOU) /* mouse */
#define KctlBeg (_KeyCtl.kbeg) /* queue-head */
#define KctlEnd (_KeyCtl.kend) /* queue-tail */
#define KctlCnt (_KeyCtl.kcnt) /* queue-count */
#define KctlMax (_KeyCtl.kmax) /* queue-size */
#define KctlBas (_KeyCtl.kbas) /* queue-base */
#define KctlBnd (_KeyCtl.kbnd) /* binding list */
#define KctlIdl (_KeyCtl.kidl) /* idle function */
#define KctlHlp (_KeyCtl.khlp) /* help keycode */
#define KctlFun (_KeyCtl.kfun) /* help function */
GBL KeyT CDC _KeyQue[]; /*- global key-queue ---------------------*/
/*------------------------[ Function prototypes ]-----------------------*/
#ifdef __cplusplus /* no mangling, please */
extern "C" {
#endif
/*- Input to active window ------*/
IntT CTYP KwGetCf(ChrP v, IntT d); /* Get valid key */
IntT CTYP KwGetCh(NOARG); /* Get key */
IntT CTYP KwGetFmt(ChrP s, ChrP f); /* Get TCXL formatted string */
IntT CTYP KwGetSn(ChrP s, IntT m); /* Get limited string */
IntT CTYP KwGetSt(ChrP ps); /* Get string */
IntT CTYP KwGetYn(IntT cd); /* Get Y|N answer */
#ifdef __TURBOC__
IntT CDC KwScanf(ChrP fs, ...); /* Get scanf() string */
#endif
/*- Input to default video ------*/
IntT CTYP KvGetCf(ChrP v, IntT d); /* Get valid key */
IntT CTYP KvGetCh(NOARG); /* Get key */
IntT CTYP KvGetFmt(ChrP s, ChrP f); /* Get TCXL formatted string */
IntT CTYP KvGetSn(ChrP s, IntT m); /* Get limited string */
VOID CTYP KvGetSt(ChrP ps); /* Get string */
IntT CTYP KvGetYn(IntT cd); /* Get Y|N answer */
#ifdef __TURBOC__
VOID CDC KvScanf(ChrP fs, ...); /* Get scanf() string */
#endif
/*- Asynchronous input ----------*/
KbndP CTYP KbndChg(KbndP l); /* Swap binding-stack pointers */
IntT CTYP KbndClr(KeyT k); /* Unbind key */
VOID CTYP KbndFre(NOARG); /* Free all stacked key-bindings */
VOID KbndIdle(VfvCP a); /* Assign idle-loop function */
IntT CTYP KbndSet(KeyT k, VfvCP f, /* Bind key to function & return */
KeyT r);
/*- Input, no echo --------------*/
VOID KeyClear(NOARG); /* Clear keyboard */
IntT CTYP KeyEvent(NOARG); /* Detect key event */
KeyT CTYP KeyGetc(NOARG); /* Get key/mouse event */
KeyT KeyPeek(NOARG); /* Peek at waiting keycode */
WrdT KeyStat(NOARG); /* Get keyboard status */
KeyT CTYP KeyTime(IntT t); /* Wait for key or time-out */
KeyT KeyWait(NOARG); /* Wait for key